<!DOCTYPE html>
<html>
 <head> 
  <meta charset="UTF-8" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no" /> 
  <title>注册</title> 
  <link rel="stylesheet" href="css/vince.css" /> 
 </head> 
 <body class="f6f6f6"> 
 <form action="">
 <div class="list_head">
 	<p><a class="back" href="JavaScript:history.go(-1)" ></a>用户注册</p>
 </div>
 <div class="sign">
 	<div class="sign_sex">
 		<h2>请选择您是<span>？</span></h2>
 		<ul>
 			<li class="designer active">
 				<a href="register.html"><span></span></a>
 				<p>我是美容师</p>
 			</li>
 			<li class="customer">
 				<a href="ct_register.html"><span></span></a>
 				<p>我是顾客</p>
 			</li>
 		</ul>
 	</div>
 	<div class="sign_input">
 		<p>
 			<img src="images/img_15.png" alt="">
 			<input type="text" placeholder="请输入您的昵称">
 		</p>
 	</div>
 	<div class="sign_input">
 		<p>
 			<img src="images/img_16.png" alt="">
 			<input type="password" placeholder="请输入6-16字母或数字密码">
 		</p>
 	</div>
 	<div class="sign_input">
 		<p>
 			<img src="images/img_16.png" alt="">
 			<input type="password" placeholder="请再次确认密码">
 		</p>
 	</div>	
 	<div class="sign_input">
 		<p>
 			<img src="images/img_17.png" alt="">
 			<input type="text" placeholder="请输入手机号码">
 			<input class="code"  id="btnSendCode" type="button" value="发送验证码" onclick="sendMessage()" /></p>  
 		</p>
 	</div>
 	<div class="sign_input">
 		<p>
 			<img src="images/img_18.png" alt="">
 			<input type="text" placeholder="请输入验证码">
 		</p>
 	</div>

 	<script type="text/javascript">
    var InterValObj;
    var count = 60; 
    var curCount;
    function sendMessage() {
        $.ajax({
            type: "get", 
            dataType: "json",
            url: 'http://115.159.106.174:8080/vanoo/weixin/phonecode.do?token=123' + $('#forget_mobile').val(),
            success: function (data) {
                if(data.code==true){
                    curCount = count;
                    $("#btnSendCode").attr("disabled", "true");
                    $("#btnSendCode").val("请在" + curCount + "秒内输入验证码");
                    InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
                }else {
                    alert(data.msg);
                }
            }
        });
    }
    //timer处理函数
    function SetRemainTime() {
        if (curCount == 0) {
            window.clearInterval(InterValObj);//停止计时器
            $("#btnSendCode").removeAttr("disabled");//启用按钮
            $("#btnSendCode").val("重新发送验证码");
        }
        else {
            curCount--;
            $("#btnSendCode").val("请在" + curCount + "秒内输入验证码");
        }
    }
</script>
 	<div class="sign_input">
 		<p>
 		<img src="images/img_19.png" alt="">
 		<span><input type="radio" name="sex" id="sex1"><label for="sex1">男</label></span>
 		<span><input type="radio" name="sex" id="sex2"><label for="sex2">女</label></span>
 		</p>
 	</div>
 	<div class="sign_input">
 		<p>
 			<img src="images/img_22.png" alt="">
 			<input type="text" placeholder="请输入年龄">
 		</p>
 	</div>
	</form>
 	<div class="sign_btn">
 		<input type="button" value="注 册">

 		<p>请仔细阅读<a href="#">《法诺服务协议》是否同意</a> 
 		<input type="checkbox" id="read">
 		<label for="read"></label>

 		</p>
 	</div>
 </div>






  <script src="js/jquery.js"> 

//	判断输入的昵称、手机号、密码是否符合
	function judge(i){
		var 	passNum = $("input[name='password']"),
				conPass=$("input[name='confirm-pass']"),
				phone = $("input[name='phone-num']"),
				accNum = $("input[name='nickname']"),
				vCode = $("input[name='code']"),
				howOld = $("input[name='howold']"),
				read = $('#read'),
				re =  /^[1][3-9][0-9]{9}$/,
				res = /^[a-zA-Z0-9]{6,16}$/,
			 	rej = /^\d{6}$/,
				reg =  /^[\u4e00-\u9fa5a-z\d_]{2,20}$/gi;
		
		    if( reg.test(accNum.val()) ){
		        	var len = accNum.val().replace(/[^\x00-\xff]/g,"aa").length;
			        if (len < 2 || len > 20){
			            alert('昵称为2-20个字符');			            
			        }
			        console.log('昵称正确');
		    }
		    else{
	        	alert('昵称为2-20个字符');	
		    }

		    if( res.test(passNum.val()) ){
				console.log('密码第一次输入正确');
			}
		    else{
				alert("密码为6-18位字母或数字");
			}
	
			if(passNum.val() == conPass.val()){
				console.log('两次密码输入一致');
			}else{
				alert('两次密码不一致')
			}

		    if( re.test(phone.val()) ){
		    	console.log('手机号输入正确');
			}
		  	else{
		  		alert("请输入正确的手机号");
			}
		  	
		  	if( rej.test(vCode.val()) ){
		  		console.log('验证码输入正确');		  		
		  	}
		  	else{
		  		alert("验证码错误");
		  	}
		  	
		  	if(howOld.val() == 'underfind' || howOld.val() == '' ){
		  		alert('请输入年龄');	
		  	}
		  	
		  	if(read.is(':checked')){
		  		console.log('已勾选协议')
		  	}
		  	else{
		  		alert('请同意协议');
		  	}
  	
		}	
		
		$.ajax({
			type:"post",
			url:"http://115.159.106.174:8080/vanoo/weixin/worker_add.do?token=123",
			async:true,
			dataType:'json',
			data:{
				fopenid:,
				fwxid:,
				fwkrname:,
				fbirthday:,
				vercode:,
				token:'123'
			},
		}).done(function(data){
			//成功
			if(data.msg == 'success'){
				console.log('注册成功');
			}
			else if(data.msg == 'failed'){
				console.log('注册失败');
			}else{
				console.log('手机号重复注册请找回密码');
			}
		}).fail(function(data){
			//失败
		}).always(function(data){
			//无论成功还是失败
		});


 </script>

  <script src="js/vince.js"></script>   
 </body>
</html>